package com.hyd.adapter;
import java.util.ArrayList;
import com.hyd.project.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ActionItemAdapter extends BaseAdapter{
    private ArrayList<String> dataList;
    private Context context;
	public ActionItemAdapter(Context context,ArrayList<String> dataList){
		this.context = context;
		this.dataList = dataList;
	}
	@Override
	public int getCount() {
		return dataList.size();
	}

	@Override
	public Object getItem(int position) {
		return dataList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}
	private class ViewHolder{
		private ImageView imageView;
		private TextView title;
		private TextView content;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.action_item, null);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder)convertView.getTag();
		}
		return convertView;
	}

}
